home *** CD-ROM | disk | FTP | other *** search
/ Amiga Tools 5 / Amiga Tools 5.iso / tools / system-tools / tinymeter / source / tinymeter_main / misc.c < prev    next >
Encoding:
C/C++ Source or Header  |  1996-03-20  |  2.6 KB  |  98 lines

  1. #include <exec/types.h>
  2. #include <exec/memory.h>
  3. #include <dos/dos.h>
  4. #include <dos/dosextens.h>
  5. #include <intuition/intuition.h>
  6. #include <intuition/gadgetclass.h>
  7. #include <intuition/intuitionbase.h>
  8. #include <intuition/classusr.h>
  9. #include <intuition/imageclass.h>
  10. #include <intuition/gadgetclass.h>
  11. #include <intuition/cghooks.h>
  12. #include <intuition/icclass.h>
  13. #include <intuition/classes.h>
  14. #include <intuition/sghooks.h>
  15. #include <intuition/screens.h>
  16. #include <graphics/gfxbase.h>
  17. #include <graphics/text.h>
  18. #include <graphics/gfxmacros.h>
  19. #include <utility/tagitem.h>
  20. #include <utility/hooks.h>
  21. #include <string.h>
  22. #include "gaugeclass.h"
  23.  
  24. int my_strlen(char s[])
  25. {
  26.    int i=0;
  27.    while (s[i]!='\0')++i;
  28.    return(i);
  29. }
  30.  
  31. UBYTE long_2_string_with_thousand(ULONG num, char output[], char point, BOOL negative)
  32. {
  33.     char             output_private[16];
  34.     char             n      = 0;
  35.     char             n_1    = 0;
  36.  
  37.     if(negative)output[n_1++]='-';
  38.     sprintf(output_private,"%12ld",num);
  39.     while(output_private[n]==0x20)n++;
  40.     for(;(output_private[n]!=0)&(output_private[n]!=0x20);n++)
  41.     {
  42.     output[n_1++]=output_private[n];
  43.     if((n==2)||(n==5)||(n==8)) output[n_1++]=(char)point;
  44.     }
  45.     output[n_1]=0;
  46.     return(n_1);
  47. }
  48.  
  49. void draw_border_new( struct RastPort *rp,ULONG x, ULONG y, ULONG width, ULONG height, int b_col1, int b_col2 )
  50. {
  51.     width--;height--;
  52.     SetAPen(rp,b_col1);
  53.     RectFill(rp,x,y,x,y+height);
  54.     RectFill(rp,x,y,x+width,y);
  55.     SetAPen(rp,b_col2);
  56.     RectFill(rp,x+width,y,x+width,y+height);
  57.     RectFill(rp,x,y+height,x+width,y+height);
  58. }
  59.  
  60. my_RectFill(struct RastPort *rp,WORD x,WORD y,WORD width,WORD height)
  61. {
  62.     if(((x+width)>1)&&((y+height)>1)) RectFill(rp,x,y,x+width-1,y+height-1);
  63. }
  64.  
  65. my_Blit(struct RastPort *src, WORD topx, WORD topy, struct RastPort *dest, WORD dtopx, WORD dtopy, WORD width, WORD height)
  66. {
  67.     ClipBlit(src,topx,topy,dest,dtopx,dtopy,width,height,0xC0);
  68. }
  69.  
  70. FreePenNew( struct Screen *scr, struct GAU_Color *col,ULONG number, ULONG *Pens)
  71. {
  72.     if(!col->pen) ReleasePen(scr->ViewPort.ColorMap,Pens[number]);
  73. }
  74.  
  75. UWORD obtainPen( struct Screen *src, struct GAU_Color *scr)
  76. {
  77.     return(scr->pen ? scr->red : ObtainBestPenA(src->ViewPort.ColorMap, scr->red, scr->green, scr->blue, 0L) );
  78. }
  79.  
  80. GetPenNew(struct gpRender *msg,struct GAU_Color *col,ULONG number, BOOL *PorC, ULONG *Pens)
  81. {
  82.     PorC[number]= col->pen ? FALSE    : TRUE;
  83.     Pens[number]= obtainPen(msg->gpr_GInfo->gi_Screen,col);
  84. }
  85.  
  86. struct TextFont *OpenTopaz()
  87. {
  88.     static struct TextAttr topaz_font =
  89.     {
  90.     "topaz.font",
  91.     8,
  92.     0,
  93.     FPF_ROMFONT,
  94.     };
  95.     return((struct TextFont *)OpenFont( &topaz_font));
  96. }
  97.  
  98.